gdk: Make GDK_TOUCH_CANCEL be dealt with similarly to GDK_TOUCH_END
authorCarlos Garnacho <carlosg@gnome.org>
Sun, 17 Apr 2016 20:19:58 +0000 (21:19 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Mon, 18 Apr 2016 13:14:33 +0000 (14:14 +0100)
We must emit the cancel event with the same semantics, and towards the GdkWindow
that is currently under the touchpoint, so make proxy_button_event() deal with
GDK_TOUCH_CANCEL.

Fixes the GDK_TOUCH_CANCEL event being emitted only on the toplevel, which is
usually non-sufficient.

gdk/gdkwindow.c

index 725b712d4ae3f35e9ae96a0061a28d8ca18293a5..5db80fa97f704e3be28933104d8c457396361fbb 100644 (file)
@@ -7697,6 +7697,7 @@ is_button_type (GdkEventType type)
         type == GDK_BUTTON_RELEASE ||
          type == GDK_TOUCH_BEGIN ||
          type == GDK_TOUCH_END ||
+         type == GDK_TOUCH_CANCEL ||
         type == GDK_SCROLL;
 }
 
@@ -9322,6 +9323,7 @@ proxy_button_event (GdkEvent *source_event,
 
     case GDK_TOUCH_BEGIN:
     case GDK_TOUCH_END:
+    case GDK_TOUCH_CANCEL:
       convert_toplevel_coords_to_window (event_win,
                                          toplevel_x, toplevel_y,
                                          &event->button.x, &event->button.y);
@@ -9337,7 +9339,7 @@ proxy_button_event (GdkEvent *source_event,
 
       gdk_event_set_source_device (event, source_device);
 
-      if ((type == GDK_TOUCH_END &&
+      if (((type == GDK_TOUCH_END || type == GDK_TOUCH_CANCEL) &&
            _gdk_event_get_pointer_emulated (source_event)) &&
            pointer_window == pointer_info->window_under_pointer &&
            gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)